package top.lfyao.designpattern.details.mediator;

public class MediatorClient {
    public static void main(String[] args){

        ConcreteMediator mediator = new ConcreteMediator();
        // 让两个具体同事类认识中介者对象
        ConcreteColleagueA concreteColleagueA = new ConcreteColleagueA(mediator);
        ConcreteColleagueB concreteColleagueB = new ConcreteColleagueB(mediator);
        // 让中介者认识各个具体同事类对象
        mediator.setConcreteColleagueA(concreteColleagueA);
        mediator.setConcreteColleagueB(concreteColleagueB);

        // 具体同事类对象的消息发送都是通过中介者对象转发
        concreteColleagueA.send("我饿了");
        concreteColleagueB.send("想回家");

    }
}
